package com.pignest.framework.json;

public class JsonNumber extends JsonValue {
	private final double value;

	public JsonNumber(int value) {
		this.value = value;
	}

	public JsonNumber(long value) {
		this.value = value;
	}

	public JsonNumber(double value) {
		this.value = value;
	}

	public JsonNumber(String text) {
		this.value = Double.parseDouble(text);
	}

	@Override
	public double getDouble() {
		return value;
	}

	@Override
	public long getLong() {
		return (long) value;
	}

	@Override
	public int getInteger() {
		return (int) value;
	}

	@Override
	public String toExternalRepresentation() {
		return Double.toString(value);
	}
}
